//Source file: D:\\test\\com\\ce\\pms\\custservice\\service\\impl\\SignReadingServiceImpl.java

package com.ce.pms.custservice.service.impl;

import java.util.List;

import org.springframework.util.Assert;

import com.ce.pms.base.service.impl.PmsBaseServiceImpl;
import com.ce.pms.base.vo.SearchVO;
import com.ce.pms.custservice.dao.ICustServiceEventDao;
import com.ce.pms.custservice.dao.ISignReadingDao;
import com.ce.pms.custservice.model.CustServiceEventDO;
import com.ce.pms.custservice.model.SignReadingRecordDO;
import com.ce.pms.custservice.service.IEventManageService;
import com.ce.pms.custservice.service.ISignReadingService;
import com.ce.pms.custservice.vo.CustServiceEventVO;
import com.ce.pms.custservice.vo.SignReadingRecordVO;
import com.ce.util.BeanUtil;
import com.sitechasia.webx.core.support.Page;
import com.sitechasia.webx.core.utils.base.PopulateUtil;
/***
 * 阅签服务
 * @author gaosong
 *
 */
public class SignReadingServiceImpl extends PmsBaseServiceImpl implements ISignReadingService {



	/***
	 * @roseuid 49436CB20119
	 *
	 */
   public SignReadingServiceImpl()
   {

   }

   /**
    * 通知客服事件管理模块阅签
    * @param CSEvent
    * @roseuid 4928252201F4
    */
   public void noteCustServieEventMangeAddSignReading(CustServiceEventVO CSEvent)
   {

   }

   /***
    * 功能描述:  阅签<br>
    * @param csEventID
    * @param signReading
    * @roseuid 4928231B0213
    * Create author:高嵩 <br>
    * Create on:2008-12-24  <br>
    * Edit author:  <br>
    * Edit on:    <br>
    * Why:     <br>
    */
   public SignReadingRecordVO addSignReading(Long csEventID, SignReadingRecordVO signReading)
   {
	   Assert.notNull(csEventID,"customerEvent ID notNull");
	   Assert.notNull(signReading);

	   SignReadingRecordDO signReadingRecordDO = new SignReadingRecordDO();
	   signReadingRecordDO = assembleV2D(signReading,signReadingRecordDO);
	   CustServiceEventDO custServiceEventDO = this.getCustServiceEventDao().findById(csEventID);
	   signReadingRecordDO.setCustomerServiceEventDO(custServiceEventDO);
	   this.getSignReadingDao().saveObject(signReadingRecordDO);
	   this.getEventManageService().noteAddSignReading(csEventID);
	   return assembleD2V(signReadingRecordDO, signReading);

   }

   /***
    * 功能描述:  根据事件ID查询阅签<br>
    * @param custServEventID
    * @return
    * @roseuid 4943576F03A9
    * Create author:高嵩 <br>
    * Create on:2008-12-24  <br>
    * Edit author:  <br>
    * Edit on:    <br>
    * Why:     <br>
    */
   public SignReadingRecordVO getSignReadingByID(Long custServEventID)
   {
	   Assert.notNull(custServEventID,"customerEvent ID notNull");
	   SignReadingRecordDO signReadingRecordDO = this.getSignReadingDao().getSignReadingByID(custServEventID);
	   if(null!=signReadingRecordDO){
		   SignReadingRecordVO signReadingRecordVO = new SignReadingRecordVO();
		   signReadingRecordVO = this.assembleD2V(signReadingRecordDO, signReadingRecordVO);

		   return signReadingRecordVO;
	   }
	   return null;

   }

   /***
    * 功能描述: VO TO DO <br>
    * @param srRecordVO
    * @param srRecordDO
    * @return
    * Create author:高嵩 <br>
    * Create on:2008-12-24  <br>
    * Edit author:  <br>
    * Edit on:    <br>
    * Why:     <br>
    */
   public SignReadingRecordDO assembleV2D(SignReadingRecordVO srRecordVO, SignReadingRecordDO srRecordDO)
   {
	   //Assert.isTrue(PopulateUtil.populate(srRecordVO, srRecordDO));
	   BeanUtil.convertVoAsDo(srRecordVO, srRecordDO);

	   srRecordDO.setSysDate(this.getSignReadingDao().getDate());
	   return srRecordDO;
   }

   /***
    * 功能描述: DO TO VO <br>
    * @param srRecordDO
    * @param srRecordVO
    * @return
    * Create author:高嵩 <br>
    * Create on:2008-12-24  <br>
    * Edit author:  <br>
    * Edit on:    <br>
    * Why:     <br>
    */
   public SignReadingRecordVO assembleD2V(SignReadingRecordDO srRecordDO, SignReadingRecordVO srRecordVO)
   {
	   Assert.isTrue(PopulateUtil.populate(srRecordDO, srRecordVO));
	   srRecordVO.setCustomerServiceEventID(srRecordDO.getCustomerServiceEventDO().getKeyword());
	   return srRecordVO;
   }

   /***
    * 功能描述:  查询阅签列表<br>
    * @param searchVO
    * @return
    * @roseuid 4943579E0177
    * Create author:高嵩 <br>
    * Create on:2008-12-24  <br>
    * Edit author:  <br>
    * Edit on:    <br>
    * Why:     <br>
    */
	public List<SignReadingRecordVO> querySignRadingList(SearchVO searchVO) {
		// TODO Auto-generated method stub
		return null;
	}

	/***
	 * 功能描述:  分页查询阅签<br>
	 * @param searchVO
	 * @return
	 * @roseuid 494357CE009C
	 * Create author:高嵩 <br>
	 * Create on:2008-12-24  <br>
	 * Edit author:  <br>
	 * Edit on:    <br>
	 * Why:     <br>
	 */

	public Page querySignReadingByPage(SearchVO searchVO) {
		// TODO Auto-generated method stub
		return null;
	}


	private ISignReadingDao signReadingDao;
	private ICustServiceEventDao custServiceEventDao;
	private IEventManageService eventManageService;
   /**
	 * @return the eventManageService
	 */
	public IEventManageService getEventManageService() {
		return eventManageService;
	}

	/**
	 * @param eventManageService the eventManageService to set
	 */
	public void setEventManageService(IEventManageService eventManageService) {
		this.eventManageService = eventManageService;
	}

/**
	 * @return the signReadingDao
	 */
	public ISignReadingDao getSignReadingDao() {
		return signReadingDao;
	}

	/**
	 * @param signReadingDao the signReadingDao to set
	 */
	public void setSignReadingDao(ISignReadingDao signReadingDao) {
		this.signReadingDao = signReadingDao;
	}

	/**
	 * @return the custServiceEventDao
	 */
	public ICustServiceEventDao getCustServiceEventDao() {
		return custServiceEventDao;
	}

	/**
	 * @param custServiceEventDao the custServiceEventDao to set
	 */
	public void setCustServiceEventDao(ICustServiceEventDao custServiceEventDao) {
		this.custServiceEventDao = custServiceEventDao;
	}

}
